/**
 * File: NodeEdge.java
 * Created by: mhaimel
 * Created on: Mar 18, 2010
 * CVS:  $Id: NodeEdge.java 1.0 Mar 18, 2010 1:57:03 PM mhaimel Exp $
 */
package uk.ac.ebi.curtain.model.graph;

/**
 * @author mhaimel
 *
 */
public enum NodeEdge {
	Start(false),
	End(true);
	
	private final boolean pos;

	private NodeEdge(boolean pos) {
		this.pos = pos;
	}
	
	public boolean asBoolean(){
		return this.pos;
	}
	
	public static NodeEdge fromBoolean(boolean val){
		if(val)
			return End;
		else 
			return Start;
	}
	
	public NodeEdge opposite(){
		return opposite(this);
	}

	public static NodeEdge opposite(NodeEdge edge) {
		switch (edge) {
		case Start:
			return End;
		case End:
			return Start;
		}
		throw new IllegalArgumentException("NodeEdge not yet supported: " + edge);
	}
	
}
